Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
RouteServiceProvider
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 boot
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
 configureRateLimiting
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Crater\Providers;
4
5use Illuminate\Cache\RateLimiting\Limit;
6use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
7use Illuminate\Http\Request;
8use Illuminate\Support\Facades\RateLimiter;
9use Illuminate\Support\Facades\Route;
10
11class RouteServiceProvider extends ServiceProvider
12{
13    /**
14     * The path to the "home" route for your application.
15     *
16     * This is used by Laravel authentication to redirect users after login.
17     *
18     * @var string
19     */
20    public const HOME = '/admin/dashboard';
21
22    /**
23     * The path to the "customer home" route for your application.
24     *
25     * This is used by Laravel authentication to redirect customers after login.
26     *
27     * @var string
28     */
29    public const CUSTOMER_HOME = '/customer/dashboard';
30
31    /**
32     * The controller namespace for the application.
33     *
34     * When present, controller route declarations will automatically be prefixed with this namespace.
35     *
36     * @var string|null
37     */
38    // protected $namespace = 'Crater\\Http\\Controllers';
39
40    /**
41     * Define your route model bindings, pattern filters, etc.
42     *
43     * @return void
44     */
45    public function boot()
46    {
47        $this->configureRateLimiting();
48
49        $this->routes(function () {
50            Route::prefix('api')
51                ->middleware('api')
52                ->namespace($this->namespace)
53                ->group(base_path('routes/api.php'));
54
55            Route::middleware('web')
56                ->namespace($this->namespace)
57                ->group(base_path('routes/web.php'));
58        });
59    }
60
61    /**
62     * Configure the rate limiters for the application.
63     *
64     * @return void
65     */
66    protected function configureRateLimiting()
67    {
68        RateLimiter::for('api', function (Request $request) {
69            return Limit::perMinute(60);
70        });
71    }
72}